<template>
  <div>
    <div class="ser_input">
      <img :src="'./static/lyl/search.png'" alt="">
      <input v-on:input="searchFn()" type="text" placeholder="搜索名称和编号" v-model="keyword">
    </div>
    <ul class="ul3">
      <li @click="ranksho(
      item)" v-for="(item,index) in rankData" :key="index">
        <img :src="item.avatar" alt="加载失败">
        <span class="bianhao">编号：{{item.id}}</span>
        <span class="Name">{{item.user_login}}</span>
        <span class="TouNum">{{item.vote}}</span>
      </li>
    </ul>

    <ul class="ul2">
      <li v-for="(item,index) in data" :key="index">
        <router-link :to="item.path" :class="$route.params.id2==index?'acti':''">
          {{item.txt}}<p v-if="$route.params.id2==index"></p>
        </router-link>
      </li>
    </ul>
  </div>
</template>

<script>
  import * as list from "../../../api/list.js";
  export default {
    name: "Ranking",
    data(){
      return {
        keyword:'',
        rankData:[],
        data:[
          {path:'/vote/4/showout/0/'+this.$route.params.id3,txt:'节目排行'},
          {path:'/vote/4/ranking/1/'+this.$route.params.id3,txt:'人气排行'},
          {path:'/vote/4/voting/2/'+this.$route.params.id3,txt:'投票说明'}
        ]
      }
    },
    beforeMount(){
      let parmes5 = {active_id:this.$route.params.id3,type:2};
      list.voteRank(parmes5).then(res=>{
        console.log('人气',res);
        this.rankData = res.data;
      })
    },
    mounted(){
      mui.back = function() {
        window.history.go(-1);
      }
    },
    methods:{
      searchFn(){
        let parmes5 = {keyword:this.keyword};
        list.contestantSearch(parmes5).then(res=>{
          console.log('搜索人气排行列表',res);
          this.rankData = res.data;
        })
      },
      ranksho(item){
        this.$router.push({
          path:'/vote/4/rankshow/'+item.id+'/'+this.$route.params.id3,
          query:{
            ishow:1
          }
        })
      }
    }
  }
</script>

<style scoped>
  .ser_input{
    margin-top: 20px;
    box-sizing: border-box;
    position: relative;
  }
  .ser_input input{
    -webkit-box-sizing:border-box;
    box-sizing: border-box;
    width: 100%;
    border: 2px solid #dcdcdc;
    padding: 13px 0 13px 82px;
    font-size: 28px;
    color: #8c8c8c;
    border-radius: 30px;
  }
  .ser_input img{
    position: absolute;
    left: 23px;
    top: 13px;
    width: 32px;
  }
  .ul3{
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .ul3 li{
    position: relative;
    width: 320px;
    height: 345px;
    background: #dcdcdc;
  }
  .ul3 li img{
    width: 100%;
    height: 100%;
  }
  .ul3 li .bianhao{
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
  }
  .ul3 li .Name{
    position: absolute;
    bottom: 10px;
    left: 10px;
    font-size: 24px;
  }
  .ul3 li .TouNum{
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 24px;
  }
  /*.ul3 li{*/
    /*border-bottom: 1px solid #dcdcdc;*/
    /*padding: 20px 40px;*/
    /*display: flex;*/
    /*justify-content: space-between;*/
  /*}*/
  /*.ul3 li:last-child{*/
    /*border-bottom:0;*/
  /*}*/
  /*.ul3 li .s-left{*/
    /*display: flex;*/
  /*}*/
  /*.ul3 li .s-left img{*/
    /*width: 100px;*/
    /*height: 100px;*/
  /*}*/
  /*.ul3 li .s-left span{*/
    /*font-size: 28px;*/
    /*align-self: center;*/
    /*margin-left: 20px;*/
  /*}*/
  /*.ul3 li>span{*/
    /*font-size: 24px;*/
    /*color: #fff;*/
    /*background: #e98345;*/
    /*width: 150px;*/
    /*height: 40px;*/
    /*align-self: center;*/
    /*text-align: center;*/
    /*line-height: 40px;*/
    /*border-radius: 5px;*/
  /*}*/

  .ul2{
    display: flex;
    justify-content: space-between;
  }
  .ul2 li{
    position: relative;
    flex-grow: 1;
    font-size: 26px;
    border-right: 1px solid #444;
    text-align: center;
  }
  .ul2 .acti{
    color: #884ca4;
  }
  .ul2 li p{
    position: absolute;
    left: 50%;
    margin-left: -52px;
    bottom: -20px;
    width: 104px;
    border: 4px solid #884ca4;
  }
  .ul2 li:last-child{
    border: none;
  }
</style>
